package com.dmai.capacity.platform.oauth.common.service.impl;

import com.dmai.capacity.platform.common.model.CapabilityPackageDeductionRule;
import com.dmai.capacity.platform.oauth.common.mapper.CapabilityPackageDeductionRuleDao;
import com.dmai.capacity.platform.oauth.common.service.ICapabilityPackageDeductionRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;


@Service
public class CapabilityPackageDeductionRuleServiceImpl implements ICapabilityPackageDeductionRuleService {

    @Autowired
    private CapabilityPackageDeductionRuleDao capabilityPackageDeductionRuleDao;

    /**
     * 保存规则
     *
     * @param rule
     */
    @Override
    public int save(CapabilityPackageDeductionRule rule) {
        rule.setUpdateTime(new Date());
        return capabilityPackageDeductionRuleDao.update(rule);
    }


    /**
     * 删除规则
     *
     * @param capabilityId
     */
    @Override
    public int delete(Integer capabilityId) {
        return capabilityPackageDeductionRuleDao.delete(capabilityId);
    }

    /**
     * 根据能力ID查询规则
     *
     * @param capabilityId
     */
    @Override
    public CapabilityPackageDeductionRule get(Integer capabilityId) {
        return capabilityPackageDeductionRuleDao.find(capabilityId);
    }

}
